#ifndef ARPCATCHLIB_H
#define ARPCATCHLIB_H

#define ARP_REQUEST 1
#define ARP_REPLY 2
#define MAXBYTES2CAPTURE 2048

typedef struct arphdr {
	u_int16_t htype;
	u_int16_t ptype;
	u_char hlen;
	u_char plen;
	u_int16_t oper;
	u_char sha[6];
	u_char spa[4];
	u_char tha[6];
	u_char tpa[4];
}arphdr_t;

// naglowek IP - zawsze 20 bajtow
struct ip_hdr {
	unsigned char ip_version_and_header_length; //dlugosc polaczonych wersji i naglowka
	unsigned char ip_tos; //typ uslugi
	unsigned short ip_len; // calkowita dlugosc
	unsigned short ip_id; // identyfikator
	unsigned short ip_frag_offset; //przesuniecie i znaczniki
	unsigned char ip_ttl; //czas waznosci - time to live
	unsigned char ip_type; // typ protokolu
	unsigned short ip_checksum; //
	unsigned int ip_src_addr;
	unsigned int ip_dest_addr;
};

struct tcp_hdr {
	unsigned short tcp_src_port;
	unsigned short tcp_dest_port;
	unsigned int tcp_seq;
	unsigned int tcp_ack;
	unsigned char reserved:4;
	unsigned char tcp_offset:4;
	unsigned char tcp_flags;
	
#define TCP_FIN 0x01
#define TCP_SYN 0x02
#define TCP_RST 0x04
#define TCP_PUSH 0x08
#define TCP_ACK 0x10
#define TCP_URG 0x20
	
	unsigned short tcp_window;
	unsigned short tcp_checksum;
	unsigned short tcp_urgent;
};

#endif
